package cn.lyq.system.domain.asset.assetrecord;

import javax.persistence.AttributeConverter;

/**
 * 出入库转换器
 */
public class InOutTypeConverter implements AttributeConverter<InOutType, Integer> {
    @Override
    public Integer convertToDatabaseColumn(InOutType attribute) {
        return attribute.getCode();
    }

    @Override
    public InOutType convertToEntityAttribute(Integer code) {
        return InOutType.of(code).orElse(null);
    }
}
